]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
calendar: Add calendar icon to events
authorFlorian Müllner <fmuellner@gnome.org>
Sun, 26 Feb 2017 02:33:26 +0000 (03:33 +0100)
committerFlorian Müllner <fmuellner@gnome.org>
Wed, 1 Mar 2017 09:55:46 +0000 (10:55 +0100)
Without the boxy background, event messages look a bit plain and
unaligned with other messages. Adding an icon addresses this,
however as repeating the same icon over and over again in case of
many events would be rather noisy, only show it for the top event
as in the mockups.

https://bugzilla.gnome.org/show_bug.cgi?id=775763

js/ui/calendar.js

index 71708bfd431c0307454881330fdf58d0f3b9bc97..32718ea6da20c72d2a95f9c3630938b0152becb5 100644 (file)
@@ -706,6 +706,14 @@ const EventMessage = new Lang.Class({
         this._date = date;
 
         this.parent(this._formatEventTime(), event.summary);
+
+        this._icon = new St.Icon({ icon_name: 'x-office-calendar-symbolic' });
+        this.setIcon(this._icon);
+
+        this.actor.connect('style-changed', () => {
+            let iconVisible = this.actor.get_parent().has_style_pseudo_class('first-child');
+            this._icon.opacity = (iconVisible ? 255 : 0);
+        });
     },
 
     _formatEventTime: function() {